package com.jspxcms.plug.repository;

import com.jspxcms.common.orm.Limitable;
import com.jspxcms.plug.domain.PlugDoctor;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.Repository;

import java.util.Collection;
import java.util.List;

public interface PlugDoctorDao extends Repository<PlugDoctor, Integer>, PlugDoctorDaoPlus {
	public Page<PlugDoctor> findAll(Specification<PlugDoctor> spec, Pageable pageable);

	public List<PlugDoctor> findAll(Specification<PlugDoctor> spec, Limitable limitable);

	public PlugDoctor findOne(Integer id);

	public PlugDoctor save(PlugDoctor bean);

	public void delete(PlugDoctor bean);

    @Query("from PlugDoctor a where a.department.id = ?1 and id <> ?2")
    public List<PlugDoctor> findOtherDoctors(Integer departmentId,Integer doctorId);
}
